package com.fdq.bigevent.mapper;

import com.fdq.bigevent.pojo.Result;
import com.fdq.bigevent.pojo.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface UserMapper {

    @Select("select * from user where username = #{username}")
    User findUserByName(String username);

    @Insert("insert into user (username, password,create_time,update_time) " +
            "values(#{username}, #{password}, now(),now())")
    int insert(String username, String password);

    @Update("update user set nickname=#{nickname},email=#{email},update_time=#{updateTime} where id = #{id}")
    int update(User user);

    @Update("update user set user_Pic=#{avatarUrl},update_time=now() where id = #{id}")
    int updateAvater(String avatarUrl, Integer id);

    @Update("update user set password=#{newPwd}, update_time=now() where id = #{id}")
    int updatePwd(String newPwd, Integer id);
}
